/**
 * 判断是否有权限的指令
 * @param  {key} 当前权限的值
 * @example  v-has="'system:crieriacategory:list'"
 */
import store from '../store'
export default function rfPermission (Vue) {
  Vue.directive('has', {
    inserted: function (el, binding) {
      const permissions = store.state.user.permissionList
      if (!permissions.includes(binding.value)) {
        el.parentNode.removeChild(el)
      }
    }
  })
}
